Replace log-bridge-agent with Swift parent process holder#4
Merged
AnemoFlower merged 4 commits intomainfrom Apr 6, 2026
Merged
Replace log-bridge-agent with Swift parent process holder#4AnemoFlower merged 4 commits intomainfrom
log-bridge-agent with Swift parent process holder#4AnemoFlower merged 4 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR replaces the previous Java log-bridge-agent approach with a Swift “holder” parent process that launches the JVM child, relays stdout/stderr over a Unix domain socket, and reports the JVM exit code back to the launcher.
Changes:
- Added
--holdermode inRunnerto spawn a child runner process, capture its output, and forward logs/exit status via UDS. - Updated
Launcherto pass--holder/--socket-path/--working-directoryarguments instead of injecting-javaagent:...log-bridge-agent.jar. - Adjusted socket loop behavior to wait for an explicit exit code message (0xFF) before exiting.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| Sources/Runner/main.swift | Implements holder mode, UDS connection + log forwarding, and child process lifecycle handling. |
| Sources/Launcher/main.swift | Updates runner invocation arguments and changes socket termination handling to use a transmitted exit code. |
Comments suppressed due to low confidence (1)
Sources/Launcher/main.swift:104
lastMessagesis still being maintained, but the crash-marker check that used it was removed. This is now unused work/state in the hot read loop; either remove it or reintroduce usage if needed.
var lastMessages: [String] = []
var exitCode: Int32?
while true {
var buffer: [UInt8] = .init(repeating: 0, count: 16384)
let bytesRead = read(clientSocket, &buffer, buffer.count)
if bytesRead > 0 {
if buffer[0] <= 1 {
if let message: String = .init(bytes: buffer[1..<bytesRead], encoding: .utf8) {
if lastMessages.count >= 10 {
lastMessages.removeFirst()
}
lastMessages.append(message)
let stream: UnsafeMutablePointer<FILE> = buffer[0] == 0 ? stdout : stderr
fputs(message, stream)
fflush(stream)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.